home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / system / exec.zip / SHELL.ASM < prev    next >
Assembly Source File  |  1988-09-12  |  4KB  |  88 lines

  1. ; Date: Tue, 16 Aug 88 18:11 PDT
  2. ; From: <MULTI%TRIUMFCL.BITNET@CORNELLC.CCS.CORNELL.EDU>
  3. ; Subject: Correction to previous version...
  4.  
  5. ;MASM SHELL;
  6. ;LINK SHELL;
  7. ;EXE2BIN SHELL SHELL.COM;
  8. ;
  9. ; Modifications:
  10. ;
  11. ;       Who             When            What
  12. ;       ===             ====            ====
  13. ;       Y.N. Miles      15-Aug-88       Tried to figure out EXEC (SHELL)
  14. ;                                       from the IBM tech. ref. manual
  15. ;                                       Gave up in disgust, wrote my own
  16. ;
  17. ;       Y.N. Miles      16-Aug-88       Char count in COMAND does not
  18. ;                                       include itself or trailing <CR>
  19. ;                                       Specify path for COMMAND.COM
  20. ;                                       Correct docs for 64K space req.
  21. ;
  22. ;NOTE:  This program is in .COM form because I cannot stand .EXE files
  23. ;
  24. code    segment
  25. assume  cs:code,ds:code,es:code
  26.         org     100h
  27. start:  mov     spsave,sp       ; Save SP pointer
  28.         mov     sssave,ss       ; Save SS block
  29. ;
  30.         mov     bx,1000h        ;  ...surrender 64K of space
  31.         mov     ah,4ah          ;  ...with this call
  32.         int     21h             ;  ...for sub-process area
  33. ;
  34.         mov     ax,5Ch          ; Get input default FCB
  35.         mov     fcbin+0,ax      ;  ...and save offset
  36.         mov     fcbin+2,es      ;  ...with segment
  37. ;
  38.         lea     si,cs:81h       ; Get input default FCB
  39.         lea     di,es:5Ch       ;  ...kosher it
  40.         mov     ax,2901h        ;  ...by filling it
  41.         int     21h             ;  ...with blanks
  42. ;
  43.         mov     ax,6Ch          ; Get output default FCB
  44.         mov     fcbot+0,ax      ;  ...and save offset
  45.         mov     fcbot+2,es      ;  ...with segment
  46. ;
  47.         lea     si,cs:81h       ; Get output default FCB
  48.         lea     di,es:6Ch       ;  ...kosher it
  49.         mov     ax,2901h        ;  ...by filling it
  50.         int     21h             ;  ...with blanks
  51. ;
  52.         mov     envir,0         ; No environment segment (so static)
  53. ;
  54.         mov     comand+0,80h    ;  ...setup command line for copy to
  55.         mov     comand+2,es     ;  ...parameter area 80h in PSP
  56. ;
  57.         lea     si,order        ; Get order count/ascii_string/<CR>
  58.         mov     cl,order        ; Get bytes in ASCII string
  59.         add     cl,2            ;  ...add two non-string bytes
  60.         mov     ch,0            ;  ...convert byte count to word count
  61.         lea     di,es:80h       ;  ...copy into DOS parameter area at 80h
  62.         rep     movsb           ;  ...the order =  count/ascii_string/CR
  63. ;
  64.         lea     dx,daemon       ; DS:BX --> Dos transient null terminated
  65.         lea     bx,envir        ; ES:BX --> Start 7 word parameter block
  66. ;
  67.         mov     ax,4B00h        ; Do the DOS exec (shell) request
  68.         int     21h             ;  ...with call
  69. ;
  70.         mov     sp,spsave       ; Restore SP
  71.         mov     ss,sssave       ;  ...and SS
  72.         ret                     ; RET uses 0 on stack to int 20h in PSP
  73. ;
  74. order   db      5,"/CDIR",13            ; Counted order for DOS, <CR> end
  75. daemon  db      "C:\COMMAND.COM",0      ; DOS transient executes order
  76. ;
  77. envir   dw      0               ; Environment segment (static,  not used)
  78. comand  dw      0,0             ; Command line dword  (points to PSP:80h)
  79. fcbin   dw      0,0             ; Input FCB dword     (points to FCB:5Ch)
  80. fcbot   dw      0,0             ; Outpt FCB dword     (points to FCB:6Ch)
  81. ;
  82. sssave  dw      0               ; Supposed to save stack segment
  83. spsave  dw      0               ; and stack pointer so RET calls INT 20h
  84. ;
  85. code    ends
  86. ;
  87. end     start
  88.